package com.xuwei.test;

import com.xuwei.pojo.User;
import com.xuwei.pojo.Users;
import com.xuwei.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:applicationContext-dao.xml","classpath:applicationContext-service.xml"})
public class UserServiceText {
    @Autowired
    private UserService userService;
    @Test
    public void loginText(){

        User user = userService.login("1001", "123");
        System.out.println(user);
        //List<Users> usersList = userService.findUserAll();
//        if (user != null) {
//            modelAndView.setViewName("success");
//            modelAndView.addObject("usersList", usersList);
//            return modelAndView;
//        }
//        modelAndView.setViewName("false");
//        return modelAndView;
    }

    @Test
    public void searchText(){
        List<Users> usersList = userService.search("许");
        System.out.println(usersList);
    }

}
